package com.qiaoyanqing.myqiubai;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar= (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        ViewPager pager= (ViewPager) findViewById(R.id.viewpager);
        List<TypeEntity> list=new ArrayList<>();
        list.add(new TypeEntity("热图","image"));
        list.add(new TypeEntity("文字","text"));
        list.add(new TypeEntity("视频","video"));
        pager.setAdapter(new TypeAdapter(getSupportFragmentManager(),list));
         //tablayout
        TabLayout tabLayout= (TabLayout) findViewById(R.id.tablayout);
        tabLayout.setupWithViewPager(pager);


    }
}
